
//package entities;


//import org.bson.types.ObjectId;
//import org.mongodb.morphia.annotations.Entity;
//import org.mongodb.morphia.annotations.Id;

/**
 * Created by Yang Fan on 2017/12/14.
 */
//@Entity(value = "Ta", noClassnameStored = true)
    /*
public class TaEntity

{
    @Id
    protected ObjectId id;

    public String getModelID() {
        return modelID;
    }
    public void setModelID(String modelID) {
        this.modelID = modelID;
    }


   String modelID;




}
*/
//////////////////////////////////////////////////////////


package entities;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.SimpleTimeZone;

import org.bson.types.ObjectId;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.annotations.*;
import org.mongodb.morphia.query.Query;
import org.mongodb.morphia.query.UpdateOperations;
import config.MongoDB;

@Entity(value = "Ta", noClassnameStored = true)
public class TaEntity {


    @Embedded  RuleEntity  rule;

    @Id
    protected ObjectId id;

    String modelID;

    public String getModelID() {
        return modelID;
    }

    public void setModelID(String modelID) {
        this.modelID = modelID;
    }

    public RuleEntity getRule() {
        return rule;
    }

    public void setRule(RuleEntity rule) {
        this.rule = rule;
    }

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }


    public static void main(String[] args) throws Exception {

        TaEntity taEntity = new TaEntity();
        taEntity.setModelID("1");
        RuleEntity rule = new RuleEntity();
        rule.setRule("123");
        taEntity.setRule(rule);

        MongoDB.instance().getDatabase().save(taEntity);


    }


}


